package com.sss.hloster0704;

public class Person {
	private int age;

//声明 setAge(int age) 方法可能抛出 AgeException  自定义异常
	public void setAge(int age) throws AgeException {
		if (age <= 0 || age >= 120) {
			throw new AgeException(age);// 抛出 AgeException自定义异常
		} else {
			this.age = age;
		}
	}
	public int getAge() {
		return age;
	}
}
